home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / test_pcl.pro < prev    next >
Text File  |  1997-07-08  |  7KB  |  228 lines

  1. ; $Id: test_pcl.pro,v 1.4 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1990-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro pcl_plot_test
  7. ;+
  8. ;
  9. ;   Procedure to test the basic plotting capabilities of the pcl driver
  10. ;
  11. ;-
  12. olddevice=!d.name
  13. set_plot,'pcl'
  14. device,/land,xsize=8,ysize=6,/inches,file='pcl_plot_test.pcl'
  15. old_pmulti=!p.multi
  16. !p.multi=[4,2,2,0,0]
  17. x=cos(6*(findgen(60)+1)/!radeg)
  18. y=sin(6*(findgen(60)+1)/!radeg)
  19. plot,x,xtitle='!8Complex Italic',ytitle='!5Duplex Roman', $
  20.   title='!12Dashed, Dotted, Diamonds!3',linestyle=2,xrange=[0,60],xsty=1
  21. oplot,y,linestyle=0,psym=-4  ; diamonds connected by solid line
  22. index=[indgen(60),reverse(indgen(60))]
  23. fillpts=[x,reverse(y)]
  24. polyfill,index,fillpts,spacing=0.8,orientation=45
  25. polyfill,index,fillpts,spacing=0.8,orientation=135   ;Finish crosshatch
  26. ;
  27. v=dist(100)
  28. contour,v,levels=[10,20,30,40,50],c_labels=[1,1,1,1,1], $
  29.   c_annotation=['!3Ten','!5Twenty','!6Thirty','!8Forty','!12Fifty!3']
  30. ;
  31. v=dist(20)
  32. surface,v
  33. ;
  34. x=[0,0,4,4,0]
  35. y=[0,2,2,0,0]
  36. plot,x,y,/nodata,title='Test of PLOTS'
  37. f=0.25
  38. for i=1,4 do $
  39.  plots,[0+i*f,0+i*f,4-i*f,4-i*f,0+i*f],[0+i*f,2-i*f,2-i*f,0+i*f,0+i*f],linest=i
  40. xyouts,0,0,'!6Unclipped, enlarged line at 45 degrees!3',/noclip, $
  41.  size=1.6,orientation=45
  42. ;
  43. !p.multi=old_pmulti
  44. device,/close
  45. set_plot,olddevice
  46. return
  47. end
  48.  
  49.  
  50.  
  51.  
  52.  
  53. pro pcl_line_test
  54. ;+
  55. ;
  56. ;   Procedure to test the linestyle capability of the IDL pcl driver
  57. ;
  58. ;-
  59. olddevice=!d.name
  60. set_plot,'pcl'
  61. device,/land,xsize=8,ysize=6,/inches,file='pcl_line_test.pcl'
  62. plot,[0,1],[1,1],xstyle=1,xrange=[-0.2,1.2],ystyle=1,yrange=[0,2],/nodata, $
  63.   xticks=14,xticklen=0.04,xtitle='14 Tick Intervals', $
  64.   title='!8Test of Linestyles (Thick Lines)',ytitle='!8Avail. Styles!3'
  65. for i=0,5 do begin
  66.    oplot,[0,1],[0.1+(0.3*i),0.1+(0.3*i)],linestyle=i,thick=2.0
  67.    xyouts,0.2,(0.2+(0.3*i)),'!8Linestyle: '+string(i,'(i1)')+'!3'
  68. endfor
  69. device,/close
  70. set_plot,olddevice
  71. return
  72. end
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. pro pcl_image_test
  80. ;+
  81. ;
  82. ;   Procedure to generate a series of TV images on a page, for a pcl driver
  83. ;     test
  84. ;
  85. ;-
  86. olddevice=!d.name
  87. set_plot,'pcl'
  88. v = bytscl(dist(900))
  89. v=255-v*(v lt 115)
  90. v[450,*]=0    ;Dark line
  91. v[*,450]=0    ;Crossing dark line
  92. device,resol=300,/land,xsize=2700,ysize=1000,xoffset=150,yoffset=150,/pixels, $
  93.        /floyd,file='pcl_image_test.pcl'
  94. tv,v,0
  95. xyouts,300,920,/device,'!6Floyd'
  96. device,/ordered
  97. tv,v,1
  98. xyouts,1200,920,/device,'Ordered'  ; Should continue to use !6 font
  99. device,threshold=100               ; Should create small black swaths
  100. tv,v,2
  101. xyouts,(2100./2700.),(920./1000.),/normal,'!6Threshold!3'
  102. device,/close
  103. set_plot,olddevice
  104. return
  105. end
  106.  
  107.  
  108.  
  109.  
  110.  
  111. pro pcl_optimize_test
  112. ;+
  113. ;
  114. ;   Procedure to test landscape and portrait graphics using all three
  115. ;      optimization methods.  A total of six output files will be
  116. ;      generated.
  117. ;
  118. ;   Note: All three optimization levels (0,1,2) are used; since not all
  119. ;      devices will support all levels, garbage could result.
  120. ;
  121. ;-
  122. olddevice=!d.name
  123. set_plot,'pcl'
  124. ;
  125. device,resol=75,/land,xsize=20,ysize=12.5,xoffset=2.5,yoffset=2.5, $
  126.   optimize=2,file='pcl_opt2_land.pcl'
  127. surface,dist(20),title='!6Opt=2, land, 75res, 20x12.5cm, 2.5x2.5cm off!3'
  128. device,/close
  129. ;
  130. device,resol=75,/land,xsize=450,ysize=300,xoffset=150,yoffset=150,/pixels, $
  131.   optimize=1,file='pcl_opt1_land.pcl'
  132. surface,dist(20),title='!6Opt=1, land, 75res, 450x300, 150x150 off!3'
  133. device,/close
  134. ;
  135. device,resol=100,/land,xsize=6,ysize=6,xoffset=2.0,yoffset=2.0,/inches, $
  136.   optimize=0,file='pcl_opt0_land.pcl'
  137. surface,dist(20),title='!6Opt=0, land, 100res, 6x6, 2x2 off!3'
  138. device,/close
  139. ;
  140. device,resol=150,/port,xsize=900,ysize=600,xoffset=150,yoffset=300,/pixels, $
  141.   optimize=2,file='pcl_opt2_port.pcl'
  142. surface,dist(20),title='!6Opt=2, port, 150res, 900x600, 150x300 off!3'
  143. device,/close
  144. ;
  145. device,resol=100,/port,xsize=4,ysize=6,xoffset=2.0,yoffset=2.0,/inches, $
  146.   optimize=1,file='pcl_opt1_port.pcl'
  147. surface,dist(20),title='!6Opt=1, port, 100res, 4x6, 2x2 off!3'
  148. device,/close
  149. ;
  150. device,resol=300,/port,xsize=6,ysize=6,xoffset=1.0,yoffset=1.0,/inches, $
  151.   optimize=0,file='pcl_opt0_port.pcl'
  152. surface,dist(20),title='!6Opt=0, port, 300res, 6x6, 1x1 off!3'
  153. device,/close
  154. ;
  155. set_plot,olddevice
  156. return
  157. end
  158.  
  159.  
  160.  
  161.  
  162. pro test_pcl
  163. ;+
  164. ; NAME:
  165. ;    test_pcl
  166. ; PURPOSE:
  167. ;    To exercise and demonstrate various aspects of the HP PCL (Printer
  168. ;    Command Language) IDL driver.
  169. ; CATEGORY:
  170. ;    Graphics Drivers.
  171. ; CALLING SEQUENCE:
  172. ;    test_pcl - Calls all test procedures, which may also be individually
  173. ;           called:
  174. ;    pcl_plot_test     - plot, contour, surface, plots, and vector fonts
  175. ;    pcl_line_test     - test of linestyles
  176. ;    pcl_image_test    - raster image output, with various dithering options
  177. ;    pcl_optimize_test - test file compression (optimization) methods
  178. ; INPUTS:
  179. ;    None
  180. ; OPTIONAL INPUT PARAMETERS:
  181. ;    None
  182. ; KEYWORD PARAMETERS:
  183. ;    None
  184. ; OUTPUTS:
  185. ;    Creates PCL disk files: pcl_plot_test.pcl, pcl_line_test.pcl,
  186. ;          pcl_image_test.pcl, pcl_opt*_land.pcl, and pcl_opt*_port.pcl.
  187. ;       These files are not automatically submitted for printing; neither
  188. ;       are they deleted automatically.
  189. ;    To print the .pcl files properly on a VMS system, it is recommended
  190. ;       that the /PASSALL qualifier be used with the PRINT command, to
  191. ;       pass all file information directly to the pcl printer.
  192. ; OPTIONAL OUTPUT PARAMETERS:
  193. ;    None
  194. ; COMMON BLOCKS:
  195. ;    None
  196. ; SIDE EFFECTS:
  197. ;    Many .pcl files will be created and left in the default directory.
  198. ; RESTRICTIONS:
  199. ;    Designed for IDL Version 2; not compatible with VMS IDL Version 1.
  200. ;
  201. ;    Procedure pcl_optimize_test uses all three (0,1,2) optimization
  202. ;       levels; since some devices do not support all of these levels,
  203. ;       garbage may result.  Specifically, the HP LaserJet II does
  204. ;       not support optimization level 1; optimization 2 was primarily
  205. ;       designed for it.  The HP DeskJet Plus supports all three
  206. ;       optimizations.
  207. ; PROCEDURE:
  208. ;    The called routines try different permutations of the allowable
  209. ;       keywords to the DEVICE procedure for PCL.  Vector plotting, contour,
  210. ;       line drawing, and surface plots are generated, as well as a series
  211. ;       of gray-scale images which test all dithering methods.  File
  212. ;       optimization options are also tested.
  213. ; MODIFICATION HISTORY:
  214. ;    Written, June 1990, TJA
  215. ;-
  216. pcl_plot_test
  217. print,'File pcl_plot_test.pcl has been completed.'
  218. pcl_line_test
  219. print,'File pcl_line_test.pcl has been completed.'
  220. pcl_image_test
  221. print,'File pcl_image_test.pcl has been completed.'
  222. pcl_optimize_test
  223. print,'Files pcl_opt*_land.pcl, and pcl_opt*_port.pcl have been completed.'
  224. print,' '
  225. print,'*** All Finished ***'
  226. return
  227. end
  228.